home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Demos / OOFILE / Buildable, limited OOFILE / OOFILE headers / oofrel.inl < prev    next >
Encoding:
Text File  |  1995-09-07  |  3.4 KB  |  177 lines  |  [TEXT/CWIE]

  1. // COPYRIGHT 1994 A.D. Software, All rights reserved
  2.  
  3. // public layer of OOFILE database
  4. // implementing relations
  5.  
  6. // inline definitions
  7.  
  8.  
  9.  
  10. // -------------------------------------------------------
  11. //                   d b R e l a t i o n
  12. // -------------------------------------------------------
  13. inline dbRelationship& dbRelationship::tables(dbTable& lhs, dbTable& rhs)
  14. {
  15.     return tables(&lhs, &rhs);
  16. }
  17.  
  18.  
  19. inline dbRelationship& dbRelationship::joinFields(dbField& lhs, dbField& rhs)
  20. {
  21.     return joinFields(&lhs, &rhs);
  22.  
  23.  
  24. inline void dbRelationship::lhs(dbTable& tbl, dbRelRefBase& linkFld, const char* str)
  25. {
  26.     lhs(&tbl, linkFld, str);
  27. }
  28.  
  29.  
  30. inline void dbRelationship::rhs(dbTable& tbl, dbRelRefBase& linkFld, const char* str)
  31. {
  32.     rhs(&tbl, linkFld, str);
  33. }
  34.  
  35.  
  36. inline void dbRelationship::lhs(dbField& joinField, dbRelRefBase& linkFld, const char* str)
  37. {
  38.     lhs(&joinField, linkFld, str);
  39. }
  40.  
  41.  
  42. inline void dbRelationship::rhs(dbField& joinField, dbRelRefBase& linkFld, const char* str)
  43. {
  44.     rhs(&joinField, linkFld, str);
  45. }
  46.  
  47.  
  48. // -------------------------------------------------------
  49. //            d b R e l H a l f
  50. // -------------------------------------------------------
  51. inline dbTable* dbRelHalf::relatesToTable() const
  52. {
  53.     return mInverseTable;
  54. }
  55.  
  56.  
  57. inline bool dbRelHalf::rhsbackendIsThisTable(const OOF_tableBackend* targetBack) const
  58. {
  59.     return mTable->pointsToBackend(targetBack);
  60.  
  61.  
  62. inline void dbRelHalf::refreshContext(dbTable* clonedTargetTable)
  63. {
  64.     if (mJoinField) 
  65.         clonedTargetTable->loadRelatedContextJoiningFromTo(mJoinField, mJoinToField);
  66.     else
  67.         ;  // NOT YET IMPLEMENTED - OID join
  68. }
  69.  
  70.  
  71. inline dbRelChain* dbRelHalf::askTableToBuildValidChain(dbRelChain* candidateChain)
  72. {
  73.     return mTable->buildRelChain(candidateChain);
  74. }
  75.  
  76.  
  77.  
  78.  
  79. // -------------------------------------------------------
  80. //           d b R e l R e f B a s e 
  81. // -------------------------------------------------------
  82. inline void dbRelRefBase::LogTransition() 
  83. {
  84.     appendRelationLink(mThisLinkRelHalf);
  85. }
  86.  
  87.  
  88. inline dbTable* dbRelRefBase::RefersToTable()
  89. {
  90.     return mThisLinkRelHalf->relatesToTable();
  91. }
  92.  
  93.  
  94. inline void dbRelRefBase::SetRelHalfByWhichWeNavigate(dbRelHalf* ref )
  95. {
  96.     assert(mThisLinkRelHalf==0);
  97.     mThisLinkRelHalf = ref;
  98. }
  99.  
  100.  
  101. inline void dbRelRefBase::newRecord() 
  102. {
  103.     if (!mRelationChain)
  104.         BuildRelChainToTable();
  105.     mRelationChain->newRecord();
  106. }
  107.  
  108.  
  109. inline void dbRelRefBase::start()
  110. {
  111.     if (!mRelationChain)
  112.         BuildRelChainToTable();
  113.     mRelationChain->startRelated();
  114. }
  115.  
  116.  
  117. inline bool dbRelRefBase::more()
  118. {
  119.     if (!mRelationChain)
  120.         BuildRelChainToTable();
  121.     return mRelationChain->moreRelated();
  122. }
  123.  
  124.  
  125. inline void dbRelRefBase::next()
  126. {
  127.     if (!mRelationChain)
  128.         BuildRelChainToTable();
  129.     mRelationChain->nextRelated();
  130. }
  131.  
  132.  
  133. inline unsigned long dbRelRefBase::count()
  134. {
  135.     if (!mRelationChain)
  136.         BuildRelChainToTable();
  137.     return mRelationChain->countRelated();
  138. }
  139.  
  140.  
  141.  
  142.  
  143. // -------------------------------------------------------
  144. //               d b R e l C h a i n
  145. // -------------------------------------------------------
  146. inline bool dbRelChain::isStillJustACandidate()
  147. {
  148.     return (mTablesList==0);
  149. }
  150.  
  151.  
  152. inline void dbRelChain::baseContextHasChanged()
  153. {
  154.     mContextValid = false;
  155. }
  156.  
  157.  
  158. inline dbTable* dbRelChain::getFinalTable()
  159. {
  160.     return mFinalTable;
  161. }
  162.  
  163.  
  164.  
  165. // -------------------------------------------------------
  166. //             O O F _ r e l C h a i n L i s t
  167. // -------------------------------------------------------
  168. inline void OOF_relChainList::append(const dbRelChain* chainPtr)
  169. {
  170.     OOF_ExpandableLongArray::append((unsigned long) chainPtr);
  171. }
  172.  
  173.  
  174.  
  175.